﻿// test_dll.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include "pch.h"
#include <iostream>
//#include "../FaceSDK_CSharp/FaceSDK_CSharp.h"
extern int face_sdk_init(const char* datafile);

extern int face_sdk_extract(const char* imgfile, char* featcode);
__declspec(dllexport) float face_sdk_compare(char* f1, char* f2, int codelen);
__declspec(dllimport) bool sdk_init_ok;
int main()
{
	int ret = face_sdk_init("D:\\develop\\exp\\HYFaceVerifyTool-3.0\\Release\\data");
	std::cout << "hhhh" <<sdk_init_ok << std::endl;
	std::cout << "Algorithm initialed  " << ret << std::endl;
	char *featcode = new char[640];
	memset(featcode, 0, 640);
	char *featcode2 = new char[640];
	memset(featcode2, 0, 640);
	float *disval = (float *)featcode;
	for (size_t i = 0; i < 128; i++)
	{
		std::cout << "code" << i << "is" << disval[i] << std::endl;
	};
	ret = face_sdk_extract("D:\\develop\\exp\\testpic\\20190620084621.jpg", featcode);
	std::cout << "Algorithm extract  " << ret << std::endl;	
	for (size_t i = 0; i < 128; i++)
	{
		std::cout << "code" << i<<"is"<< disval[i] << std::endl;
	};
	ret = face_sdk_extract("D:\\develop\\exp\\testpic\\20190620084633.jpg", featcode2);
	disval = (float *)featcode2;
	std::cout << "Algorithm extract  " << ret << std::endl;
	for (size_t i = 0; i < 128; i++)
	{
		std::cout << "code" << i << "is" << disval[i] << std::endl;
	};
	float score = face_sdk_compare(featcode, featcode2, 640);
	std::cout << "score = " << score << std::endl;
	
	delete[]featcode;

}

// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
// 调试程序: F5 或调试 >“开始调试”菜单

// 入门提示: 
//   1. 使用解决方案资源管理器窗口添加/管理文件
//   2. 使用团队资源管理器窗口连接到源代码管理
//   3. 使用输出窗口查看生成输出和其他消息
//   4. 使用错误列表窗口查看错误
//   5. 转到“项目”>“添加新项”以创建新的代码文件，或转到“项目”>“添加现有项”以将现有代码文件添加到项目
//   6. 将来，若要再次打开此项目，请转到“文件”>“打开”>“项目”并选择 .sln 文件
